package com.javacode2018.lesson001.demo12;

import com.javacode2018.lesson001.demo5.IocUtil;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Author: hongsir
 * @Date: 2024/10/10 - 10 - 10 - 17:10
 * @Description: com.javacode2018.lesson001.demo12
 * @Version: 1.0
 */
public class BeanExtendTest {
    @Test
    public void normalBean() {
        String beanXml = "classpath:/com/javacode2018/lesson001/demo12/normalBean.xml";
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(beanXml);
        System.out.println("serviceB:" + context.getBean(ServiceB.class));
        System.out.println("serviceC:" + context.getBean(ServiceC.class));
    }

    @Test
    public void extendBean() {
        String beanXml = "classpath:/com/javacode2018/lesson001/demo12/extendBean.xml";
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(beanXml);
        System.out.println("extend-serviceB:" + context.getBean(ServiceB.class));
        System.out.println("extend-serviceC:" + context.getBean(ServiceC.class));
        System.out.println(context.getBean("baseService"));
    }
}
